<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 *
 * @package     anime
 * @author      Do Ngoc Son (ngocson2306@gmail.com)
 * @copyright   PHP TEAM
 * @link        http://phpandmysql.net
 * @since       Version 1.0
 * @phone       0982644370
 *
 */
class Mrequest extends MY_Model{
	public $table = 'request';
	public $key   = 'r_id';
	public function __construct(){
		parent:: __construct();
		
	}

    public function save($id=false,$data=array()){
    	if(!$id){
    		$this->insert($data);
    	}
    	$result = $this->update($id,$data);
    	if($result){
    		return $id;
    	}
    	return false;
    } 

    public function count_undred(){
        $this->db->select($this->key);
        $this->db->from($this->table);
        $this->db->where('r_status',0);
        $num_results = $this->db->count_all_results();
        return $num_results;
    }
}